#include <iostream>
#include <string>

using namespace std;

int main() {
    int k;
    char s1[256], s2[256];
    string str;
    cin >> k >> s1 >> s2;
    getline(cin, str);
    getline(cin, str);

    const char *s = str.c_str();

    int count = 0;
    size_t s1_length = strlen(s1);
    size_t s2_length = strlen(s2);
    size_t s_length = strlen(s);
    bool is_replace = false;
    for (int i = 0; i < s_length - s1_length; ++i) {
        if (strncmp(&s[i], s1, s1_length) != 0) {
            continue;
        }
        count++;
        if (count == k) {
            char res[256];
            strncpy(res, s, i);
            strncpy(&res[i], s2, s2_length);
            strncpy(&res[i + s2_length], &s[i + s1_length], s_length - i - s1_length);
            res[s_length + s2_length - s1_length + 1] = '\0';

            cout << res << endl;
            is_replace = true;
        }
    }
    if (!is_replace) {
        cout << "F" << endl;
    }
}